<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>    


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加会员</title>
<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
<script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/localization/messages_zh.js"></script>
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
 
<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
 
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>


<script src="<%=request.getContextPath()%>/js/AddMember.js"></script>
<style>
.error{
	color:red;
}
</style>

</head>
<body>
<c:set var="baseURL" value="${pageContext.request.contextPath}" scope="request"/>
<p>${infoadd}</p>
<div class="container" style="margin:5% 0 0 0">
	<div class="row clearfix">
		<div class="col-md-2 column">
		</div>
		<div class="col-md-8 column">
		
			<form role="form"  action="AddMember.do"  method="post" id="AddMember" >
			
				<div class="form-group">
					 <label for="realname">真实姓名(*)</label>
					 <input type="text" class="form-control" id="realname" name="realname" value="" required minlength="2"/>
				</div>
				<div class="form-group">
					 <label for="idcard">身份证号(*)</label>
					 <input type="text" class="form-control" id="idcard" name="idcard" value="" onchange="ic()" required minlength="18"/>
				</div>
				<div class="form-group">
					 <label for="name">昵称(*)</label>
					 <input type="text" class="form-control" id="name" name="name" value="" readOnly="true"/>
				</div>
				<div class="form-group">
					 <label for="password">密码(*)</label>
					 <input type="text" class="form-control" id="password" value="123456" name="password" readOnly="true"/>
				</div>
					<div class="form-group">
					 <label for="mg_id">会员等级</label>
					 <select name="mg_id" class="form-control" id="mg_id" onchange="show_tuijian(this.options[this.options.selectedIndex].value)"> 
                             <c:if test="${empty sysmgname}">
                             <option value=" ">抱歉！无等级信息</option> 
							 </c:if>
							 <c:if test="${!empty sysmgname}">
									<c:forEach items="${sysmgname}" var="sysmgn">
										   <option value="${sysmgn.mg_id}">${sysmgn.member_grade_name}</option>
									</c:forEach>
							</c:if>
                     </select> 
				</div>
				<div class="form-group form-inline">
				  
					 <label for="reward">会员等级奖励费</label>
					 <input type="text" class="form-control" id="reward" value="" name="reward" required minlength="1" readOnly="true"/>
					
					 <label for="unit">奖励费单位</label>
					  <input type="text" class="form-control" id="unit" value="" name="unit" readOnly="true"/>
					  
				</div>
				<div class="form-group ">
					 <label for="status">账户状态</label>
					
					 <select name="status" class="form-control" id="status"> 
                             <option value="生效">生效</option> 
                             <option value="冻结">冻结</option> 
                     </select> 
				</div>
				<div class="form-group">
					 <label for="leader_id">领导人(ID)</label>
					   <input type="text" class="form-control" id="leader_id" value="${LOGINUSER.id}" name="leader_id" readOnly="true">
					
				</div>
				<div class="form-group">
					 <label for="referee_id">推荐人</label>
					  <select name="referee_id" class="form-control" id="referee_id">
                             <c:if test="${empty laf}">
                             <option value=" ">抱歉！无推荐人信息</option> 
							 </c:if>
							 <c:if test="${!empty laf}">
									<c:forEach items="${laf}" var="la">
										   <option value="${la.id}">${la.name}</option>
									</c:forEach>
							</c:if>
                     </select> 
				</div>
				<div class="form-group">
					 <label for="InMoney">入费（地币）</label>
					 <input type="text" class="form-control" id="InMoney" value="25" name="InMoney" readOnly="true"/>
				</div>
				<div class="form-group">
					 <label for="create_time">创建时间</label>
					 <input type="text" class="form-control" id="create_time" name="create_time" value=""/>
				</div>
				<div>
				<input type="submit" class="btn btn-default"  value="添加" style="width:100%;background:#33AECC;color:#fff"  ></input>
				</div>
			</form>
		</div>
		<div class="col-md-2 column">
		</div>
		
	</div>
</div>
<script>     
    function show_tuijian(v){     
        /* alert(v);     */ 
        $.get("${baseURL}/findtuijianmoney?mg_id="+v,
				function(result){//result返回的结果
        	        $("mg_id").val(result.mg_id);
					$("#unit").val(result.unit);
					$("#reward").val(result.reward);
					
				});
    }     
</script>   
</body>
</html>